package ownTemplates;

import java.awt.*;
import java.awt.geom.Ellipse2D;

/**
 * 〈一句话功能简述>
 * 〈绘图工具类〉
 *
 * @Author 17505
 * @Create 2021/6/2
 * @Since 1.0.0
 */
public class AlgoVisHelper {

    private AlgoVisHelper(){}

    public static void setStrokeWidth(Graphics2D g2d, int width) {
        int strokeWidth = width;
        g2d.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    }

    public static void setColor(Graphics2D g2d, Color color) {
        g2d.setColor(color);
    }

    public static void strokeCircle(Graphics2D g2d, int x, int y, int r) {
        Ellipse2D circle = new Ellipse2D.Double(x - r, y - r, 2 * r, 2 * r);
        g2d.draw(circle);
    }
    public static void fillCircle(Graphics2D g2d, int x, int y, int r) {
        Ellipse2D circle = new Ellipse2D.Double(x - r, y - r, 2 * r, 2 * r);
        g2d.fill(circle);
    }

    public static void pause(int time) {
        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            System.out.println("Error" );
        }
    }
}